using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace ebookreader
{
    public abstract class PopUp : Menu
    {
        #region Fields

        float alpha = 0;
        FadeState fade_state;
        PopUp parent_popup;
        #endregion

        public PopUp(Game game, Rectangle area)
            : base(game, area)
        {
            fade_state = FadeState.FadeIn;
        }

        public PopUp(Game game)
            : base(game)
        {
            fade_state = FadeState.FadeIn;
        }

        public override void Initialize()
        {

            base.Initialize();
        }

        public override void Update(GameTime gameTime)
        {
            float dt = (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (fade_state == FadeState.FadeIn)
                alpha = MathHelper.Clamp(alpha + dt, 0, 1.0f);
            else
                alpha = MathHelper.Clamp(alpha - dt, 0, 1.0f);

            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            //sprite_batch.Begin();
            //for (int i = 0; i < entries.Count; i++)
            //    entries[i].DrawInsideSpriteBatch(alpha);

            //for (int i = 0; i < renderables.Count; i++)            
            //    renderables[i].DrawAfterBegin(alpha);
            //sprite_batch.End();
            base.Draw(gameTime);
        }
    }
}
